Data Structure is a way to store and organize data so that it can be used efficiently.
There are two types of data structures:
Primitive data structure
The primitive data structures are primitive data types.
The int, char, float, double, and pointer are the primitive data structures that can hold a single value.
Non-primitive data structure
The non-primitive data structure is divided into two types:
Linear data structure
The arrangement of data in a sequential manner is known as a linear data structure.
The data structures used for this purpose are Arrays, Linked list, Stacks, and Queues.
In these data structures, one element is connected to only one another element in a linear form.
Non-linear data structure
When one element is connected to the 'n' number of elements known as a non-linear data structure.
The best example is trees and graphs. In this case, the elements are arranged in a random manner.
Data structures can also be classified as:
Static data structure: It is a type of data structure where the size is allocated at the compile time. Therefore, the maximum size is fixed.
Dynamic data structure: It is a type of data structure where the size is allocated at the run time. Therefore, the maximum size is flexible.
Major Operations:-
The major or the common operations that can be performed on the data structures are:
Searching: We can search for any element in a data structure.
Sorting: We can sort the elements of a data structure either in an ascending or descending order.
Insertion: We can also insert the new element in a data structure.
Updation: We can also update the element, i.e., we can replace the element with another element.
Deletion: We can also perform the delete operation to remove the element from the data structure.
Advantages of Data structures
The following are the advantages of a data structure:
Efficiency: If the choice of a data structure for implementing a particular ADT is proper,
it makes the program very efficient in terms of time and space.
Reusability: The data structure provides reusability means that
multiple client programs can use the data structure.
Abstraction: The data structure specified by an ADT also provides the level of abstraction.
The client cannot see the internal working of the data structure,
so it does not have to worry about the implementation part.
The client can only see the interface.
Arrays are the most basic data structures.
We have already learnt arrays in various programming languages